package com.corecloud.controller.statisticalCenter;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.corecloud.entity.SysAreaEntity;
import com.corecloud.entity.SysAreaForStatisticsEntity;
import com.corecloud.service.SysAreaForStatisticsService;
import com.corecloud.service.SysAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.security.Principal;
import java.util.List;

// 统计中心
@Controller
@RequestMapping("/statisticalCenter")
public class StatisticalCenterController {

    @Autowired
    private SysAreaService sysAreaService;

    @Autowired
    private SysAreaForStatisticsService sysAreaForStatisticsService;

    /**
     * 统计中心首页
     * @param principal 登录用户信息
     * @return
     */
    @RequestMapping("/index")
    public ModelAndView index(Principal principal){
        ModelAndView modelAndView = new ModelAndView("statisticalCenter/index");

        // 所有市及直辖市
        List<SysAreaForStatisticsEntity> areaList = sysAreaForStatisticsService.selectList(new QueryWrapper<SysAreaForStatisticsEntity>().eq("area_parent_id","410000"));

        modelAndView.addObject("areaList",areaList);

        return modelAndView;
    }


    /**
     * 院校统计中心首页
     * @param principal 登录用户信息
     * @return
     */
    @RequestMapping("/schoolIndex")
    public ModelAndView schoolIndex(Principal principal){
        ModelAndView modelAndView = new ModelAndView("statisticalSchoolLevel/index");

        // 所有市及直辖市
        List<SysAreaEntity> areaList = sysAreaService.selectList(new QueryWrapper<SysAreaEntity>().eq("area_parent_id","410000"));

        modelAndView.addObject("areaList",areaList);

        return modelAndView;
    }




}
